<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: RingBuffer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classRingBuffer.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classRingBuffer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">RingBuffer Class Reference<div class="ingroups"><a class="el" href="group__util.html">Utilities Library (jetson-utils)</a> &raquo; <a class="el" href="group__threads.html">Multithreading</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Thread-safe circular ring buffer queue.  
 <a href="classRingBuffer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="RingBuffer_8h_source.html">RingBuffer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:add028ff4436a9c7467ea5df2d81623a4"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4">Flags</a> { <br />
&#160;&#160;<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4ae7368f8f66751388d6eca8acab34e8b2">Read</a> = (1 &lt;&lt; 0), 
<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a5d7fba78a3b416422add48911552b788">ReadOnce</a> = (1 &lt;&lt; 1) | Read, 
<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a618d08b68f28a0deebc922c4fd29b150">ReadLatest</a> = (1 &lt;&lt; 2) | Read, 
<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a016f5aaf642491df7dd14d2728b38973">ReadLatestOnce</a> = (1 &lt;&lt; 3) | ReadLatest, 
<br />
&#160;&#160;<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4aa40fc1352f6c1c44e21d12a856cd9e35">Write</a> = (1 &lt;&lt; 4), 
<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a1118d6f9d4da6a8b6fbc5d6de4c093e9">Threaded</a> = (1 &lt;&lt; 5), 
<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a5a1ff357668813e74eb7656cc035f91e">ZeroCopy</a> = (1 &lt;&lt; 6)
<br />
 }</td></tr>
<tr class="memdesc:add028ff4436a9c7467ea5df2d81623a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ring buffer flags.  <a href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4">More...</a><br /></td></tr>
<tr class="separator:add028ff4436a9c7467ea5df2d81623a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae18d0a5ac60eb4db2f99887772ed5778"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#ae18d0a5ac60eb4db2f99887772ed5778">RingBuffer</a> (uint32_t flags=<a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a1118d6f9d4da6a8b6fbc5d6de4c093e9">Threaded</a>)</td></tr>
<tr class="memdesc:ae18d0a5ac60eb4db2f99887772ed5778"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new ring buffer.  <a href="classRingBuffer.html#ae18d0a5ac60eb4db2f99887772ed5778">More...</a><br /></td></tr>
<tr class="separator:ae18d0a5ac60eb4db2f99887772ed5778"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2715b2e99ea24521ef7a586c2f33e1c9"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a2715b2e99ea24521ef7a586c2f33e1c9">~RingBuffer</a> ()</td></tr>
<tr class="memdesc:a2715b2e99ea24521ef7a586c2f33e1c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="classRingBuffer.html#a2715b2e99ea24521ef7a586c2f33e1c9">More...</a><br /></td></tr>
<tr class="separator:a2715b2e99ea24521ef7a586c2f33e1c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41718c1a3577dee2d0f7cfea02667535"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a41718c1a3577dee2d0f7cfea02667535">Alloc</a> (uint32_t numBuffers, size_t size, uint32_t flags=0)</td></tr>
<tr class="memdesc:a41718c1a3577dee2d0f7cfea02667535"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate memory for a set of buffers, where each buffer has the specified size.  <a href="classRingBuffer.html#a41718c1a3577dee2d0f7cfea02667535">More...</a><br /></td></tr>
<tr class="separator:a41718c1a3577dee2d0f7cfea02667535"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a787fdb833c95a386e6ec3e19fb6d1fd8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a787fdb833c95a386e6ec3e19fb6d1fd8">Free</a> ()</td></tr>
<tr class="memdesc:a787fdb833c95a386e6ec3e19fb6d1fd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free the buffer allocations.  <a href="classRingBuffer.html#a787fdb833c95a386e6ec3e19fb6d1fd8">More...</a><br /></td></tr>
<tr class="separator:a787fdb833c95a386e6ec3e19fb6d1fd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65cd66112df93d973d7425295c382055"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a65cd66112df93d973d7425295c382055">Peek</a> (uint32_t flags)</td></tr>
<tr class="memdesc:a65cd66112df93d973d7425295c382055"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the next read/write buffer without advancing the position in the queue.  <a href="classRingBuffer.html#a65cd66112df93d973d7425295c382055">More...</a><br /></td></tr>
<tr class="separator:a65cd66112df93d973d7425295c382055"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc642b75c7ebe3aa48da4ece8f13643b"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#adc642b75c7ebe3aa48da4ece8f13643b">Next</a> (uint32_t flags)</td></tr>
<tr class="memdesc:adc642b75c7ebe3aa48da4ece8f13643b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the next read/write buffer and advance the position in the queue.  <a href="classRingBuffer.html#adc642b75c7ebe3aa48da4ece8f13643b">More...</a><br /></td></tr>
<tr class="separator:adc642b75c7ebe3aa48da4ece8f13643b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a13c5161ed54ede296a4c5f079fbaface"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a13c5161ed54ede296a4c5f079fbaface">GetFlags</a> () const</td></tr>
<tr class="memdesc:a13c5161ed54ede296a4c5f079fbaface"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the flags of the ring buffer.  <a href="classRingBuffer.html#a13c5161ed54ede296a4c5f079fbaface">More...</a><br /></td></tr>
<tr class="separator:a13c5161ed54ede296a4c5f079fbaface"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9066deaa7cee206d7f604a443766955"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#ab9066deaa7cee206d7f604a443766955">SetFlags</a> (uint32_t flags)</td></tr>
<tr class="memdesc:ab9066deaa7cee206d7f604a443766955"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the ring buffer's flags.  <a href="classRingBuffer.html#ab9066deaa7cee206d7f604a443766955">More...</a><br /></td></tr>
<tr class="separator:ab9066deaa7cee206d7f604a443766955"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a39008053c6aa06e348fa5b2ead2f91"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a1a39008053c6aa06e348fa5b2ead2f91">SetThreaded</a> (bool threaded)</td></tr>
<tr class="memdesc:a1a39008053c6aa06e348fa5b2ead2f91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable or disable multi-threading.  <a href="classRingBuffer.html#a1a39008053c6aa06e348fa5b2ead2f91">More...</a><br /></td></tr>
<tr class="separator:a1a39008053c6aa06e348fa5b2ead2f91"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a884afb997bffaf51d550e88d97e062d2"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a884afb997bffaf51d550e88d97e062d2">mNumBuffers</a></td></tr>
<tr class="separator:a884afb997bffaf51d550e88d97e062d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2322c263d4e1e928848ff4c33893713"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#ab2322c263d4e1e928848ff4c33893713">mLatestRead</a></td></tr>
<tr class="separator:ab2322c263d4e1e928848ff4c33893713"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a767436a25c53cfb845f731e0ff633120"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a767436a25c53cfb845f731e0ff633120">mLatestWrite</a></td></tr>
<tr class="separator:a767436a25c53cfb845f731e0ff633120"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3177dcbe1bf1a936e810a709361df94"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#aa3177dcbe1bf1a936e810a709361df94">mFlags</a></td></tr>
<tr class="separator:aa3177dcbe1bf1a936e810a709361df94"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1828b9679d7da6caaa486b2bca487d42"><td class="memItemLeft" align="right" valign="top">void **&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a1828b9679d7da6caaa486b2bca487d42">mBuffers</a></td></tr>
<tr class="separator:a1828b9679d7da6caaa486b2bca487d42"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5025680071ca78b1e204d4931d2a70cd"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a5025680071ca78b1e204d4931d2a70cd">mBufferSize</a></td></tr>
<tr class="separator:a5025680071ca78b1e204d4931d2a70cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52c369f6697dea2696e0b4b9be08b622"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#a52c369f6697dea2696e0b4b9be08b622">mReadOnce</a></td></tr>
<tr class="separator:a52c369f6697dea2696e0b4b9be08b622"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8fadecc95016c471104fbadb1b0e9f3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classMutex.html">Mutex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRingBuffer.html#ad8fadecc95016c471104fbadb1b0e9f3">mMutex</a></td></tr>
<tr class="separator:ad8fadecc95016c471104fbadb1b0e9f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Thread-safe circular ring buffer queue. </p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a id="add028ff4436a9c7467ea5df2d81623a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add028ff4436a9c7467ea5df2d81623a4">&#9670;&nbsp;</a></span>Flags</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4">RingBuffer::Flags</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Ring buffer flags. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4ae7368f8f66751388d6eca8acab34e8b2"></a>Read&#160;</td><td class="fielddoc"><p>Read the next buffer. </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4a5d7fba78a3b416422add48911552b788"></a>ReadOnce&#160;</td><td class="fielddoc"><p>Read the next buffer, but only if it hasn't been read before. </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4a618d08b68f28a0deebc922c4fd29b150"></a>ReadLatest&#160;</td><td class="fielddoc"><p>Read the latest buffer in the queue, skipping other buffers that may not have been read. </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4a016f5aaf642491df7dd14d2728b38973"></a>ReadLatestOnce&#160;</td><td class="fielddoc"><p>Combination of ReadOnce and ReadLatest flags. </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4aa40fc1352f6c1c44e21d12a856cd9e35"></a>Write&#160;</td><td class="fielddoc"><p>Write the next buffer. </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4a1118d6f9d4da6a8b6fbc5d6de4c093e9"></a>Threaded&#160;</td><td class="fielddoc"><p>Buffers should be thread-safe (enabled by default). </p>
</td></tr>
<tr><td class="fieldname"><a id="add028ff4436a9c7467ea5df2d81623a4a5a1ff357668813e74eb7656cc035f91e"></a>ZeroCopy&#160;</td><td class="fielddoc"><p>Buffers should be allocated in mapped CPU/GPU zeroCopy memory (otherwise GPU only) </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae18d0a5ac60eb4db2f99887772ed5778"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae18d0a5ac60eb4db2f99887772ed5778">&#9670;&nbsp;</a></span>RingBuffer()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">RingBuffer::RingBuffer </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>flags</em> = <code><a class="el" href="classRingBuffer.html#add028ff4436a9c7467ea5df2d81623a4a1118d6f9d4da6a8b6fbc5d6de4c093e9">Threaded</a></code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Construct a new ring buffer. </p>

</div>
</div>
<a id="a2715b2e99ea24521ef7a586c2f33e1c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2715b2e99ea24521ef7a586c2f33e1c9">&#9670;&nbsp;</a></span>~RingBuffer()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">RingBuffer::~RingBuffer </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a41718c1a3577dee2d0f7cfea02667535"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a41718c1a3577dee2d0f7cfea02667535">&#9670;&nbsp;</a></span>Alloc()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool RingBuffer::Alloc </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>numBuffers</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>flags</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Allocate memory for a set of buffers, where each buffer has the specified size. </p>
<p>If the requested allocation is compatible with what was already allocated, this will return <code>true</code> without performing additional allocations. Otherwise, the previous buffers are released and new ones are allocated.</p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the allocations succeeded or was previously done. <code>false</code> if a memory allocation error occurred. </dd></dl>

</div>
</div>
<a id="a787fdb833c95a386e6ec3e19fb6d1fd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a787fdb833c95a386e6ec3e19fb6d1fd8">&#9670;&nbsp;</a></span>Free()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void RingBuffer::Free </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Free the buffer allocations. </p>

</div>
</div>
<a id="a13c5161ed54ede296a4c5f079fbaface"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a13c5161ed54ede296a4c5f079fbaface">&#9670;&nbsp;</a></span>GetFlags()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t RingBuffer::GetFlags </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the flags of the ring buffer. </p>

</div>
</div>
<a id="adc642b75c7ebe3aa48da4ece8f13643b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adc642b75c7ebe3aa48da4ece8f13643b">&#9670;&nbsp;</a></span>Next()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void* RingBuffer::Next </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>flags</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the next read/write buffer and advance the position in the queue. </p>

</div>
</div>
<a id="a65cd66112df93d973d7425295c382055"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65cd66112df93d973d7425295c382055">&#9670;&nbsp;</a></span>Peek()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void* RingBuffer::Peek </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>flags</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the next read/write buffer without advancing the position in the queue. </p>

</div>
</div>
<a id="ab9066deaa7cee206d7f604a443766955"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab9066deaa7cee206d7f604a443766955">&#9670;&nbsp;</a></span>SetFlags()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void RingBuffer::SetFlags </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>flags</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the ring buffer's flags. </p>

</div>
</div>
<a id="a1a39008053c6aa06e348fa5b2ead2f91"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1a39008053c6aa06e348fa5b2ead2f91">&#9670;&nbsp;</a></span>SetThreaded()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void RingBuffer::SetThreaded </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>threaded</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable or disable multi-threading. </p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a1828b9679d7da6caaa486b2bca487d42"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1828b9679d7da6caaa486b2bca487d42">&#9670;&nbsp;</a></span>mBuffers</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void** RingBuffer::mBuffers</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a5025680071ca78b1e204d4931d2a70cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5025680071ca78b1e204d4931d2a70cd">&#9670;&nbsp;</a></span>mBufferSize</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t RingBuffer::mBufferSize</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="aa3177dcbe1bf1a936e810a709361df94"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3177dcbe1bf1a936e810a709361df94">&#9670;&nbsp;</a></span>mFlags</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t RingBuffer::mFlags</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="ab2322c263d4e1e928848ff4c33893713"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab2322c263d4e1e928848ff4c33893713">&#9670;&nbsp;</a></span>mLatestRead</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t RingBuffer::mLatestRead</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a767436a25c53cfb845f731e0ff633120"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a767436a25c53cfb845f731e0ff633120">&#9670;&nbsp;</a></span>mLatestWrite</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t RingBuffer::mLatestWrite</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="ad8fadecc95016c471104fbadb1b0e9f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8fadecc95016c471104fbadb1b0e9f3">&#9670;&nbsp;</a></span>mMutex</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classMutex.html">Mutex</a> RingBuffer::mMutex</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a884afb997bffaf51d550e88d97e062d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a884afb997bffaf51d550e88d97e062d2">&#9670;&nbsp;</a></span>mNumBuffers</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t RingBuffer::mNumBuffers</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a52c369f6697dea2696e0b4b9be08b622"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52c369f6697dea2696e0b4b9be08b622">&#9670;&nbsp;</a></span>mReadOnce</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool RingBuffer::mReadOnce</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>jetson-utils/<a class="el" href="RingBuffer_8h_source.html">RingBuffer.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classRingBuffer.html">RingBuffer</a></li>
    <li class="footer">Generated on Fri Mar 17 2023 14:29:30 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
